from flask import Flask, request, jsonify, render_template, make_response

from src.day11.log_util import logger

# 实例化一个app

app = Flask(__name__)


@app.route("/json")
def jsonify_demo():
    return jsonify({"status": 200})


@app.route("/json1")
def jsonify_demo1():
    return jsonify(status=200, msg="请求成功")


@app.route("/html")
def html():
    return render_template("demo.html")


@app.route("/")
def index():
    rsp = make_response(render_template("demo.html"))
    rsp.set_cookie('{"school":"hogwarts"}')
    rsp.headers["school"] = "hogwarts"
    return rsp


if __name__ == '__main__':
    app.run()
